import request from "@/utils/request";
import requestMd5 from "@/utils/requestMd5";

export function get_sale_chart(params) {
  return request({
    url: "/report/saleChart",
    method: "get",
    params
  });
}
export function get_profit_chart(params) {
  return request({
    url: "/report/profitChart",
    method: "get",
    params
  });
}
export function get_purchase_chart(params) {
  return request({
    url: "/report/purchaseChart",
    method: "get",
    params
  });
}

export function get_sales_list(params) {
  return request({
    url: "/report/getList",
    method: "get",
    params
  });
}

/* 导出 */
//  销售报表 - 订单列表
export function export_order_order(params) {
  return request({
    url: "/export/report_order",
    // url: "/report/exportSaleOrder",
    method: "post",
    responseType: "blob",
    params
  });
}
//  销售报表 - 商户
export function export_order_user(params) {
  return request({
    url: "/export/report_user",
    method: "post",
    responseType: "blob",
    params
  });
}

//  销售报表 - 商品列表
export function export_order_goods(params) {
  return request({
    url: "/export/report_goods",
    method: "post",
    responseType: "blob",
    params
  });
}
//  销售报表 - 分类
export function export_order_category(params) {
  return request({
    url: "/export/report_goods_category",
    method: "post",
    responseType: "blob",
    params
  });
}

/* 利润报表 */
//  利润报表 - 日利润
export function export_profit_day(params) {
  return request({
    url: "/export/report_lirun_order",
    method: "post",
    responseType: "blob",
    params
  });
}
//  利润报表 - sku
export function export_profit_sku(params) {
  return request({
    url: "/export/report_lirun_sku",
    method: "post",
    responseType: "blob",
    params
  });
}

//  利润报表 - 商户
export function export_profit_user(params) {
  return request({
    url: "/export/report_lirun_company",
    method: "post",
    responseType: "blob",
    params
  });
}

//  利润报表 - 大类
export function export_profit_category(params) {
  return request({
    url: "/export/report_lirun_category",
    method: "post",
    responseType: "blob",
    params
  });
}

/* 损耗报表 */
export function get_loss_chart(params) {
  return request({
    url: "/report/ullageChart",
    method: "get",
    params
  });
}

export function get_loss_list(params) {
  return request({
    url: "/report/getUllageList",
    method: "get",
    params
  });
}

export function export_report_purchase_u(params) {
  return request({
    url: "/export/export_report_purchase_u",
    method: "post",
    responseType: "blob",
    params
  });
}

/* 修改--上面的接口因为数据有问题，全部重新请求下面的接口   2021-3-30修改 */

/* ----  销售报表--开始  ---- */
// 订单
export function get_saleOrder(params) {
  return request({
    url: "/report/saleOrder",
    method: "get",
    params
  });
}

// 用户
export function get_saleMember(params) {
  return request({
    url: "/report/saleMember",
    method: "get",
    params
  });
}
// 用户--商品明细
export function get_saleMemberGoods(params) {
  return request({
    url: "/report/saleMemberGoods",
    method: "get",
    params
  });
}
// 用户--每日明细
export function get_saleMemberDetail(params) {
  return request({
    url: "/report/saleMemberDetail",
    method: "get",
    params
  });
}
// 商品
export function get_saleGoods(params) {
  return request({
    url: "/report/saleGoods",
    method: "get",
    params
  });
}
export function get_saleCategory(params) {
  return request({
    url: "/report/saleCategory",
    method: "get",
    params
  });
}

//商品--日报表
export function get_saleGoodsDetail(params) {
  return request({
    url: "/report/saleGoodsDetail",
    method: "get",
    params
  });
}

//商品--用户
export function get_saleGoodsMemberDetail(params) {
  return request({
    url: "/report/saleGoodsMemberDetail",
    method: "get",
    params
  });
}

// 订单导出
export function export_exportSaleOrder(params) {
  return request({
    url: "/report/exportSaleOrder",
    method: "post",
    responseType: "blob",
    params
  });
}
// 用户导出
export function export_exportSaleMember(params) {
  return request({
    url: "/report/exportSaleMember",
    method: "post",
    responseType: "blob",
    params
  });
}
export function export_exportSaleMemberGoods(params) {
  return request({
    url: "/report/exportSaleMemberGoods",
    method: "post",
    responseType: "blob",
    params
  });
}
export function export_exportSaleMemberDetail(params) {
  return request({
    url: "/report/exportSaleMemberDetail",
    method: "post",
    responseType: "blob",
    params
  });
}
// 商品导出
export function export_exportSaleGoods(params) {
  return request({
    url: "/report/exportSaleGoods",
    method: "post",
    responseType: "blob",
    params
  });
}
export function export_exportSaleGoodsDetail(params) {
  return request({
    url: "/report/exportSaleGoodsDetail",
    method: "post",
    responseType: "blob",
    params
  });
}

export function export_exportSaleGoodsMemberDet(params) {
  return request({
    url: "/report/exportSaleGoodsMemberDetail",
    method: "post",
    responseType: "blob",
    params
  });
}
export function export_exportSaleCategory(params) {
  return request({
    url: "/report/exportSaleCategory",
    method: "post",
    responseType: "blob",
    params
  });
}
/* ----  销售报表--结束  ---- */

/* ---------------------  next  -------------------- */

/* ----  利润报表--开始  ---- */
// 日报表
export function get_profitOrder(params) {
  return request({
    url: "/report/profitOrder",
    method: "get",
    params
  });
}
// 订单利润
export function get_profitOrderDetail(params) {
  return request({
    url: "/report/profitOrderDetail",
    method: "get",
    params
  });
}
//用户
export function get_profitMember(params) {
  return request({
    url: "/report/profitMember",
    method: "get",
    params
  });
}

// 商品
export function get_profitGoods(params) {
  return request({
    url: "/report/profitGoods",
    method: "get",
    params
  });
}
// 分类
export function get_profitCategory(params) {
  return request({
    url: "/report/profitCategory",
    method: "get",
    params
  });
}

// 导出
export function export_exportProfitOrder(params) {
  return request({
    url: "/report/exportProfitOrder",
    method: "post",
    responseType: "blob",
    params
  });
}
export function export_exportProfitOrderDetail(params) {
  return request({
    url: "/report/exportProfitOrderDetail",
    method: "post",
    responseType: "blob",
    params
  });
}
export function export_exportProfitMember(params) {
  return request({
    url: "/report/exportProfitMember",
    method: "post",
    responseType: "blob",
    params
  });
}

export function export_exportProfitGoods(params) {
  return request({
    url: "/report/exportProfitGoods",
    method: "post",
    responseType: "blob",
    params
  });
}
export function export_exportProfitCategory(params) {
  return request({
    url: "/report/exportProfitCategory",
    method: "post",
    responseType: "blob",
    params
  });
}

/* ----  利润报表--结束  ---- */

/* ----  采购报表---开始  ---- */

//采购单
export function get_zcGetPurchaseReportList(params) {
  return request({
    url: "/report/zcGetPurchaseReportList",
    method: "get",
    params
  });
}
// 商品
export function get_zcGetGoodsReportList(params) {
  return request({
    url: "/report/zcGetGoodsReportList",
    method: "get",
    params
  });
}
// 商品明细
export function get_zcGetSkuDetailPurReport(params) {
  return request({
    url: "/report/zcGetSkuDetailPurReport",
    method: "get",
    params
  });
}
// 导出商品明细
export function export_zcExportSkuDetailPurReport(params) {
  return request({
    url: "/report/zcExportSkuDetailPurReport",
    method: "get",
    responseType: "blob",
    params
  });
}

// 采购员/供应商
export function get_zcGetBuySupplierReportList(params) {
  return request({
    url: "/report/zcGetBuySupplierReportList",
    method: "get",
    params
  });
}
// 采购单导出
export function export_purcahse_order(params) {
  return request({
    url: "/report/zcExportPurchaseReportList",
    method: "get",
    responseType: "blob",
    params
  });
}
//  商品导出
export function export_purcahse_sku(params) {
  return request({
    url: "/report/zcExportGoodsReportList",
    method: "get",
    responseType: "blob",
    params
  });
}
//  采购员导出
export function export_purcahse_user(params) {
  return request({
    url: "/report/zcExportBuySupplierReportList",
    method: "get",
    responseType: "blob",
    params
  });
}

/* ----  采购报表---结束  ---- */

/* ----  损耗报表---开始  ---- */
// 总损耗
export function get_ullageAll(params) {
  return request({
    url: "/report/ullageAll",
    method: "get",
    params
  });
}
// 总损耗导出
export function export_exportullageall(params) {
  return request({
    url: "/report/exportUllageAll",
    method: "post",
    responseType: "blob",
    params
  });
}
// 盘点损耗
export function get_ullageInventory(params) {
  return request({
    url: "/report/ullageInventory",
    method: "get",
    params
  });
}
// 盘点损耗导出
export function export_exportullageinventory(params) {
  return request({
    url: "/report/exportUllageInventory",
    method: "post",
    responseType: "blob",
    params
  });
}
// 退货损耗
export function get_ullagereturn(params) {
  return request({
    url: "/report/ullageReturn",
    method: "get",
    params
  });
}
// 退货损耗导出
export function export_exportUllageReturn(params) {
  return request({
    url: "/report/exportUllageReturn",
    method: "post",
    responseType: "blob",
    params
  });
}
//采购商品
export function get_ullagepurchase(params) {
  return request({
    url: "/report/ullagePurchase",
    method: "get",
    params
  });
}
export function export_exportullagepurchase(params) {
  return request({
    url: "/report/exportUllagePurchase",
    method: "post",
    responseType: "blob",
    params
  });
}

// 商品损耗每日明细
export function get_ullagePurchaseDetail(params) {
  return request({
    url: "/report/ullagePurchaseDetail",
    method: "get",
    params
  });
}
export function export_exportUllagePurchaseDetail(params) {
  return request({
    url: "/report/exportUllagePurchaseDetail",
    method: "post",
    responseType: "blob",
    params
  });
}

//采购员

export function get_ullagebuyerandsupplier(params) {
  return request({
    url: "/report/ullageBuyerAndSupplier",
    method: "get",
    params
  });
}
export function export_exportullagebuyerandsupplier(params) {
  return request({
    url: "/report/exportUllageBuyerAndSupplier",
    method: "post",
    responseType: "blob",
    params
  });
}

// 采购员 供应商 损耗 日明细
export function get_ullageBuyerAndSupplierDay(params) {
  return request({
    url: "/report/ullageBuyerAndSupplierDay",
    method: "get",
    params
  });
}
export function export_exportUllageBuyerAndSupplierDay(params) {
  return request({
    url: "/report/exportUllageBuyerAndSupplierDay",
    method: "post",
    responseType: "blob",
    params
  });
}

/* ----  损耗报表---结束  ---- */

// 公共信息
export function get_report_base(params) {
  return request({
    url: "/report/base",
    method: "get",
    params
  });
}

// 成本校对
export function order_saveCost(data) {
  return requestMd5({
    url: "/orderList/saveCost ",
    method: "post",
    data: data
  });
}
